﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/taglibs.jsp" %>
<c:if test="${fn:length(jobs)>0}">
		<table id="jobs">
<c:choose>
	<c:when test="${conf.parameterSize>0}">
			<tr>
				<th rowspan="2">JobId</th>
				<th rowspan="2">Submitter</th>
				<th rowspan="2">SubmitTime</th>
				<th rowspan="2">LaunchTime</th>
				<th rowspan="2">FinishTime</th>
				<th rowspan="2">WaitTime</th>
				<th rowspan="2">RunTime</th>
				<th rowspan="2">TotalTime</th>
				<th rowspan="2">Status</th>
				<th rowspan="2">Result</th>
				<th colspan="${conf.parameterSize}">Parameters</th>
				<th rowspan="2">&nbsp;</th>
			</tr>
			<tr>
		<c:forEach var="p" items="${conf.parameters}">
				<th>${p.name}</th>
		</c:forEach>
			</tr>
	</c:when>
	<c:otherwise>
			<tr>
				<th>JobId</th>
				<th>Submitter</th>
				<th>SubmitTime</th>
				<th>LaunchTime</th>
				<th>FinishTime</th>
				<th>WaitTime</th>
				<th>RunTime</th>
				<th>TotalTime</th>
				<th>Status</th>
				<th>Result</th>
				<th>&nbsp;</th>
			</tr>
	</c:otherwise>
</c:choose>
<c:forEach var="job" items="${jobs}">
			<tr>
				<td><a href="job-result.action?identifier=${job.identifier.stringIdentifier}">${job.identifier.stringIdentifier}</a></td>
				<td>${job.submitter}</td>
				<td>${ss:dateFormat(job.submitTime)}</td>
				<td>${ss:dateFormat(job.launchTime)}</td>
				<td>${ss:dateFormat(job.finishTime)}</td>
				<td>${ss:timeBetween(job.launchTime, job.submitTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.launchTime)}</td>
				<td>${ss:timeBetween(job.finishTime, job.submitTime)}</td>
				<td>${job.status}</td>
				<td><c:if test="${ss:isFinished(job.status)}"><c:choose>
					<c:when test="${job.succeed}"><img alt="success" src="images/icons/ok.jpg" title="success"></c:when>
					<c:otherwise><img alt="fail" src="images/icons/error.png" title="fail"></c:otherwise>
				</c:choose></c:if></td>
	<c:if test="${conf.parameterSize>0}">
		<c:forEach var="p" items="${conf.parameters}">
				<td>${ss:getMapValue(job.parameters, p.name)}</td>
		</c:forEach>
	</c:if>
				<td>
	<c:if test="${conf.parameterSize>0}">
					<a href="run-job-conf.action?identifier=${conf.identifier.stringIdentifier}&jobIdentifier=${job.identifier.stringIdentifier}"><img alt="以此参数执行" src="images/icons/play.png" title="以此参数执行"></a>
	</c:if>
	<c:if test="${(ss:isFinished(job.status) || job.status=='retry') && !job.succeed}">
					<a href="run-job-conf.action?action=reExecute&jobIdentifier=${job.identifier.stringIdentifier}"><img alt="重新执行" src="images/icons/reload.png" title="重新执行"></a>
					<a href="run-job-conf.action?action=reExecute&jobIdentifier=${job.identifier.stringIdentifier}&failedOnly=true"><img alt="仅重新执行错误的" src="images/icons/reload2.png" title="仅重新执行错误的"></a>
	</c:if>
				</td>
			</tr>
</c:forEach>
			<tr><td>(此处仅列出前30条) <a href="job-search.action?confIdentifier=${conf.identifier.stringIdentifier}&submitFrom=">查看全部</a><td></tr>
		</table>
</c:if>